home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2007 December
/
PCWKCD1207B.iso
/
Blogowanie poza sfera
/
Flock 1.0 beta
/
flock-1.0RC3.en-US.win32.exe
/
flock
/
components
/
flockPhoto.js
< prev
next >
Wrap
Text File
|
2007-10-18
|
4KB
|
109 lines
//
// BEGIN FLOCK GPL
//
// Copyright Flock Inc. 2005-2007
// http://flock.com
//
// This file may be used under the terms of of the
// GNU General Public License Version 2 or later (the "GPL"),
// http://www.gnu.org/licenses/gpl.html
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
//
// END FLOCK GPL
//
const FLOCK_PHOTO_CID = Components.ID('{5844743e-41a6-400c-a659-93e0067d1d68}');
const FLOCK_PHOTO_CONTRACTID = '@flock.com/photo;1';
const FLOCK_PHOTO_IID = Components.interfaces.flockIPhoto;
function flockPhoto() {
}
flockPhoto.prototype= {
id: "",
thumbnail: "",
webPageUrl: "",
midSizePhoto: "",
largeSizePhoto: "",
title: "",
username: "",
userid: "",
is_public: "true",
is_video: "false",
buildTooltip: function( ) {
// do we have to use document from the window to ceate elements? -- ja
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var win = wm.getMostRecentWindow('navigator:browser');
if (!win) return;
var lbl = win.document.createElement('label');
lbl.setAttribute('value', this.title );
return lbl;
},
buildHTML: function( ) {
return '<a title="'+this.title+'" href="'+this.webPageUrl+'"><img src="'+this.midSizePhoto+'" border="0" /></a>';
},
buildBBCode: function ( ) {
return '[url=' + this.webPageUrl + '][img]'+ this.midSizePhoto +'[/img][/url]';
},
buildMiniPage: function ( ) {
return '<html><head><title>' + this.title +
' (' + this.username + ')</title></head><body><center>' +
this.buildHTML( ) + '</center></body></html>';
},
QueryInterface: function(iid) {
if (!iid.equals(Components.interfaces.nsISupports) &&
!iid.equals(FLOCK_PHOTO_IID))
throw Components.results.NS_ERROR_NO_INTERFACE;
return this;
}
};
var flockPhotoModule = {
registerSelf: function(compMgr, fileSpec, location, type) {
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
compMgr.registerFactoryLocation(FLOCK_PHOTO_CID,
"flockPhoto JS component",
FLOCK_PHOTO_CONTRACTID,
fileSpec,
location,
type);
},
getClassObject: function(compMgr, cid, iid) {
if (!cid.equals(FLOCK_PHOTO_CID))
throw Components.results.NS_ERROR_NO_INTERFACE;
if (!iid.equals(Components.interfaces.nsIFactory))
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
return flockPhotoFactory;
},
canUnload: function(compMgr) { return true; }
};
var flockPhotoFactory = {
createInstance: function(outer, iid) {
if (outer != null)
throw Components.results.NS_ERROR_NO_AGGREGATION;
if (!iid.equals(FLOCK_PHOTO_IID) &&
!iid.equals(Components.interfaces.nsISupports))
throw Components.results.NS_ERROR_INVALID_ARG;
return new flockPhoto();
}
}
/* module initialisation */
function NSGetModule(comMgr, fileSpec) { return flockPhotoModule; }